<template>
	<!-- 城市回收站 -->
	<view class="cityRecycle">
		<navbar :titleText="recycleInfo.name"></navbar>
		<view class="cityRecycle-main">
			<view class="cityRecycleMain-ability">
				<view class="boxList">
					<view class="coins">{{recycleInfo.balance}}</view>
					<view class="list-text">可用回收币</view>
				</view>
				<view class="boxList" @tap="outbound(0)">
					<view class="list-img">
						<image src="https://huishou.68699.cn/addons/wjyk_recycle/public/static/index/out.png" mode=""></image>
					</view>
					<view class="list-text">出库</view>
				</view>
				<view class="boxList">
					<view class="list-img">
						<image src="https://huishou.68699.cn/addons/wjyk_recycle/public/static/index/verification.png" mode=""></image>
					</view>
					<view class="list-text">扫码核验</view>
				</view>
			</view>
			<!-- 支出汇总 -->
			<view class="expend">
				<view class="expendTitle">
					<text class="zhichu">支出汇总</text>
					<text class="danwei">(单位：回收币)</text>
				</view>
				<view class="sumList" @tap="inSumexpenses(1)">
					<view class="list-img">
						<image src="https://huishou.68699.cn/addons/wjyk_recycle/public/static/index/week.png" mode="aspectFill"></image>
					</view>
					<view class="list-content">
						<view class="list-title">本周</view>
						<view class="content">
							<text class="num">支出笔数：{{recycleInfo.weekTotal}}</text>
							<text class="content-coins">支出：{{recycleInfo.weekPrice}}</text>
						</view>
					</view>
					<view class="icon iconfont icon-xiangyoujiantou"></view>
				</view>
				<view class="sumList" @tap="inSumexpenses(2)">
					<view class="list-img">
						<image src="https://huishou.68699.cn/addons/wjyk_recycle/public/static/index/month.png" mode="aspectFill"></image>
					</view>
					<view class="list-content">
						<view class="list-title">本月</view>
						<view class="content">
							<text class="num">支出笔数：{{recycleInfo.monthTotal}}</text>
							<text class="content-coins">支出：{{recycleInfo.monthPrice}}</text>
						</view>
					</view>
					<view class="icon iconfont icon-xiangyoujiantou"></view>
				</view>
				<view class="sumList" @tap="inSumexpenses(3)">
					<view class="list-img">
						<image src="https://huishou.68699.cn/addons/wjyk_recycle/public/static/index/season.png" mode="aspectFill"></image>
					</view>
					<view class="list-content">
						<view class="list-title">本季</view>
						<view class="content">
							<text class="num">支出笔数：{{recycleInfo.quarterTotal}}</text>
							<text class="content-coins">支出：{{recycleInfo.quarterPrice}}</text>
						</view>
					</view>
					<view class="icon iconfont icon-xiangyoujiantou"></view>
				</view>
				<view class="sumList sumListEnd" @tap="inSumexpenses(4)">
					<view class="list-img">
						<image src="https://huishou.68699.cn/addons/wjyk_recycle/public/static/index/year.png" mode="aspectFill"></image>
					</view>
					<view class="list-content">
						<view class="list-title">本年</view>
						<view class="content">
							<text class="num">支出笔数：{{recycleInfo.yearTotal}}</text>
							<text class="content-coins">支出：{{recycleInfo.yearPrice}}</text>
						</view>
					</view>
					<view class="icon iconfont icon-xiangyoujiantou"></view>
				</view>
			</view>
			<!-- 累计出库 -->
			<view class="sumOutbound" @tap="outbound(1)">
				<view class="sumList">
					<view class="list-img">
						<image src="https://huishou.68699.cn/addons/wjyk_recycle/public/static/index/cumulative-delivery.png" mode="aspectFill"></image>
					</view>
					<view class="list-content">累计出库</view>
					<view class="icon iconfont icon-xiangyoujiantou"></view>
				</view>
			</view>
			
			<view class="addrecycler" @tap="addrecycler">
				添加回收员
			</view>
		</view>
	</view>
</template>

<script>
	import util from '@/component/commen/api/util.js';//引入封装的请求
	import navbar from "@/component/count/navBar.vue";
	export default {
		components:{
			navbar
		},
		data() {
			return {
				recycleInfo:"",//回收站信息
			};
		},
		onShow() {
			this.getRecycleInfo()
		},
		methods:{
			getRecycleInfo(){//获取回收站信息
				var params = {
				    do:"pack",
				    op:"detail",
					packid:uni.getStorageSync("packid")
				}
				util.requestWithSign(params).then(res=>{
					console.log("获取的回收站信息：",res)
					this.recycleInfo = res.data
				})
			},
			outbound(e){//点击出库
				uni.navigateTo({
					url:`/otherPages/outbound/outbound?outboundId=${e}`
				})
			},
			inSumexpenses(value){//点击支出汇总
				uni.navigateTo({
					url:`/otherPages/sumexpenses/sumexpenses?type=${value}`
				})
			},
			addrecycler(){//点击添加回收员
				uni.navigateTo({
					url:"/otherPages/addRecover/addRecover"
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
.cityRecycle{
	.cityRecycle-main{
		padding: 0 20rpx;
		padding-top: 170rpx;
		box-sizing: border-box;
		.cityRecycleMain-ability{
			padding:40rpx 20rpx;
			background: #fff;
			border-radius: 30rpx;
			box-sizing: border-box;
			display: flex;
			align-items: flex-end;
			text-align: center;
			.boxList{
				flex: 1;
				.coins{
					font-size: 37rpx;
					font-weight: bold;
					color: #ffd756;
				}
				.list-img{
					width: 60rpx;
					height: 60rpx;
					margin: 0 auto;
					image{
						width: 100%;
						height: 100%;
					}
				}
				.list-text{
					margin-top: 20rpx;
					font-size:28rpx;
					color: #8c8c8c;
				}
			}
		}
		.expend{
			padding: 20rpx 0;
			background: #fff;
			margin-top: 20rpx;
			border-radius: 30rpx;
			.expendTitle{
				margin-left: 20rpx;
				padding-left: 10rpx;
				border-left: 8rpx solid #00b388;
				font-size: 27rpx;
				.zhichu{
					font-weight: bold;
				}
				.danwei{
					display: inline-block;
					margin-left: 10rpx;
					color: #8c8c8c;
				}
			}
			.sumList{
				margin-top: 20rpx;
				display: flex;
				padding: 20rpx;
				align-items: center;
				box-sizing: border-box;
				border-bottom: 2rpx solid #eee;
				.list-img{
					width:80rpx;
					height: 80rpx;
					margin-right: 20rpx;
					image{
						width: 100%;
						height: 100%;
						border-radius: 30rpx;
					}
				}
				.list-content{
					.list-title{
						font-size: 29rpx;
					}
					.content{
						color: #8c8c8c;
						font-size: 24rpx;
						margin-top: 10rpx;
						.num{
							margin-right: 40rpx;
						}
					}
				}
				.icon-xiangyoujiantou{
					margin-left: auto;
				}
			}
			.sumListEnd{
				border: 0;
			}
		}
		.sumOutbound{
			background: #fff;
			padding: 20rpx 0;
			background: #fff;
			margin-top: 20rpx;
			border-radius: 30rpx;
			.sumList{
				// margin-top: 20rpx;
				display: flex;
				padding: 0 20rpx;
				align-items: center;
				box-sizing: border-box;
				// border-bottom: 2rpx solid #eee;
				.list-img{
					width:60rpx;
					height: 60rpx;
					margin-right: 20rpx;
					image{
						width: 100%;
						height: 100%;
						border-radius: 30rpx;
					}
				}
				.list-content{
					.list-title{
						font-size: 29rpx;
					}
					.content{
						color: #8c8c8c;
						font-size: 24rpx;
						margin-top: 10rpx;
						.num{
							margin-right: 40rpx;
						}
					}
				}
				.icon-xiangyoujiantou{
					margin-left: auto;
				}
			}
		}
		.addrecycler{
			width: 220rpx;
			border-radius: 30rpx;
			background: #00b388;
			color: #fff;
			text-align: center;
			padding: 20rpx 0;
			margin-top: 20rpx;
		}
	}
}
</style>
